home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / sources.arc / DANG_SRC.LZH / ESTABS2.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  59.4 KB  |  1,931 lines

  1. #include <globals2.h>
  2. #define    Setpalette(a)    xbios(6,a)
  3. #define    Kbrate(a,b)    (int)xbios(35,a,b)
  4. #define    Bconstat(a)    (int)bios(1,a)
  5. extern int  buffer[];        /* holds the char info for disk loading and saving */
  6.  
  7. char open1[] = "2 door1";/* creaky*/             /* that -q disables intro mssg on play.ttp */
  8. char open2[] = "2 door2";/*AR door*/        /* but i call it 'player' */
  9.  
  10. char chant[] = "2 chant";
  11. char heal0[] = "2 heal0";
  12. char applause[] = "2 appla";
  13. extern char CAST[];
  14.  
  15.  
  16. temple(mf_src,mf_dest,pxyarray,scr6)
  17. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  18. char *scr6;  /* addr of misc 3.dat has temple pic */
  19. int pxyarray[8];
  20.     
  21. {
  22.  char com;
  23.  int f;
  24.  int s_ave[4];
  25.   
  26. v_gtext(handle,197,99,"    Temple    ");
  27.  
  28. for(f=0;f<4;f++) s_ave[f] = pxyarray[f]; /*save array */
  29.  clear_it();
  30.  /********* Load up a pix for the inside of the temple ***************/
  31.  
  32.             mf_src->fd_addr = (long) scr6; /* copy address */
  33.    
  34.            pxyarray[0] = 194;
  35.       pxyarray[1] = 93;  /* get the src rectangle */
  36.       pxyarray[2] = 316;
  37.       pxyarray[3] = 181; 
  38.       
  39.        vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  40.  
  41.  
  42.  
  43. /*********************************/
  44. invoke_tsr( chant );
  45. do
  46. {
  47.  v_gtext(handle,6,19,"You're greeted at the");
  48.  v_gtext(handle,6,27,"temple entrance by a ");
  49.  v_gtext(handle,6,35,"monk. He asks , ");
  50.  v_gtext(handle,6,43,"'How may I help thee");
  51.  v_gtext(handle,6,51," Brother?'");
  52.  v_gtext(handle,6,67," A)sk for Blessing");
  53.  v_gtext(handle,6,75," E)xit Temple     ");
  54.  
  55. while (!(Bconstat(2)))
  56.   {
  57.     v_gtext(handle,6,67,"  "); 
  58.     v_gtext(handle,6,75,"  "); 
  59.  
  60.      pauser();
  61.  
  62.     v_gtext(handle,6,67," A"); 
  63.     v_gtext(handle,6,75," E"); 
  64.    pauser();
  65.  
  66.    }
  67.  
  68.  
  69.  com = Bconin(2);
  70. }
  71.  while ( com != 'A' && com !='a' && com != 'E' && com != 'e' );
  72.  
  73. if ( com == 'A' || com =='a' )
  74.   {
  75.    clear_it();
  76.    v_gtext(handle,6,11,"All I ask of thou is ");
  77.    v_gtext(handle,6,19,"for a small donation ");
  78.    v_gtext(handle,6,27,"Accept? [y/n]");
  79.    com =Bconin(2);
  80.    if( com == 'Y' || com == 'y' )
  81.    {
  82.    v_gtext(handle,6,35,"May the gods praise you");
  83.    v_gtext(handle,6,43,"my son....");
  84.    pause();
  85.    clear_it();
  86.    user.gold = user.gold - (user.gold * 0.10); /* donate 10% */ 
  87.    v_gtext(handle,6,11,"The monk leads you ");
  88.    v_gtext(handle,6,19,"through a maze of ");
  89.    v_gtext(handle,6,27,"corridors. After what");
  90.    v_gtext(handle,6,35,"seems like an eternity");
  91.    v_gtext(handle,6,43,"you come upon an altar");
  92.    v_gtext(handle,6,51,"bathed in a pure white");
  93.    v_gtext(handle,6,59,"glow. He tells you to");
  94.    v_gtext(handle,6,67,"lay upon it. As you do");
  95.    v_gtext(handle,6,75,"so your body jerks in");
  96.    v_gtext(handle,6,83,"a series of spasms. ");
  97.   invoke_tsr( heal0 );
  98.       com = Bconin(2);
  99.    clear_it();
  100.     v_gtext(handle,6,11,"Finally the sensation");
  101.    v_gtext(handle,6,19,"passes. The monk grins");
  102.    v_gtext(handle,6,27,"and says, ");
  103.    v_gtext(handle,6,35,"' That wasn't too bad ");
  104.    v_gtext(handle,6,43,"  eh?' ");
  105.              /* inc the hp */
  106.              /* and sp */
  107.    user.hp += user.con;
  108.    user.sp += user.con;
  109.    if( user.hp > user.max_hp) user.hp = user.max_hp;
  110.    if( user.sp > user.max_sp) user.sp = user.max_sp;
  111.   
  112.    v_gtext(handle,6,51,"You give him a look of");
  113.    v_gtext(handle,6,59,"disgust and quicky");
  114.    v_gtext(handle,6,67,"exit the temple...");
  115.    pause();
  116.   } 
  117.  }
  118.  
  119.     for(f=0;f<4;f++)  pxyarray[f]= s_ave[f]; /*restore array */
  120. }  /* end of module TEMPLE */
  121.  
  122. /*********************************************************************/
  123.  
  124.  
  125.  
  126.  
  127.  
  128. /********************************************************************/
  129. inn()
  130. {
  131. char com,com2;
  132. int check_random,g,amount=0,delta=0,c_time,sleep_time=0,dummy,test=0;
  133. /* dummy, holds value returned from events call. We dont care 
  134.   what it is... */
  135. clear_it();
  136.  
  137. v_gtext(handle,197,99,"     Inn      ");
  138.  
  139.  
  140. invoke_tsr( open2 );
  141. do       /* main do , do until select Exit! */
  142. {
  143.  
  144.  
  145.  
  146.  display_user_stats();         /* update stats */
  147.  clear_it();                   /* clear screen */
  148.  
  149.  v_justified(handle,6,19,"You see all types of people",184,0,1);
  150.  v_justified(handle,6,27,"milling about the common room",184,0,1);
  151.  v_gtext(handle,6,35,"You walk up to the ");
  152.  v_gtext(handle,6,43,"counter and the chubby");
  153.  v_gtext(handle,5,51,"inkeep looks at you ");
  154.  v_gtext(handle,6,59,"and says...");
  155.  v_justified(handle,6,67,"'How may I help thee Friend?'",184,0,1);
  156.  v_gtext(handle,6,75," A)sk the time  W)ork");
  157.  v_gtext(handle,6,83," R)ent a room   E)xit");
  158.  
  159. while (!(Bconstat(2)))
  160.   {
  161.     v_gtext(handle,6,75,"  "); v_gtext(handle,134,75," ");
  162.     v_gtext(handle,6,83,"  "); v_gtext(handle,134,83," ");
  163.  
  164.      pauser();
  165.  
  166.     v_gtext(handle,6,75," A"); v_gtext(handle,134,75,"W");
  167.     v_gtext(handle,6,83," R"); v_gtext(handle,134,83,"E");
  168.    pauser();
  169.  
  170.    }
  171. do
  172. {
  173.  com = Bconin(2);
  174. }
  175.  while ( com != 'A' && com !='a' && com != 'R' && com != 'r' &&
  176.          com != 'W' && com !='w' && com != 'E' && com != 'e' );
  177.  
  178.  
  179. clear_it();
  180.  
  181. if ( com == 'W' || com =='w' )
  182.   {
  183.  
  184.  
  185.    check_random = rnd(100);
  186.    if ( check_random > 90 )
  187.    {
  188.    v_justified(handle,6,11,"The inkeeper says,",184,0,1);
  189.    g = rnd(10);
  190.    switch (g)
  191.     {
  192.       case 0:
  193.       case 1:case 2:case3:
  194.       case 4: v_gtext(handle,6,19,"I need a guard.");
  195.               break;
  196.       case 5: v_gtext(handle,6,19,"I need a courier.");
  197.               break;
  198.       case 6:case7:case 8:
  199.       case 9: v_gtext(handle,6,19,"I need a handyman.");
  200.     }
  201.  
  202.    sprintf(string,"It pays %d gp",g+user.con);
  203.    v_gtext(handle,6,27,string);
  204.    v_gtext(handle,6,35,"Do you want it [y/n]");
  205.   do{ com2 = Bconin(2);
  206.     }while (com2 != 'N' && com2 !='n' && com2 !='Y' && com2 != 'y');
  207.    if ( com2 == 'Y' || com2 == 'y' )
  208.    {
  209.     clear_it();
  210.     v_gtext(handle,6,11,"Working....");
  211.     
  212.     user.gold += g+user.con;
  213.            /* update TIME! 3 HOURS!!! */
  214.     
  215.        /* mod 12, hours */
  216.      for(g=0;g<3;g++)
  217.       {
  218.       time = HOUR_VALUE;   /* Dentoe an hour has passed */
  219.      
  220.       sleeppause();                /* working and update time at same time */
  221.       check_random=events(); /* update events while working */
  222.       
  223.      }
  224.    }  
  225.   
  226. } /* end of inkeep HAS A JOB FOR YOU to do */
  227.  
  228. else
  229.   {
  230.    v_gtext(handle,6,11,"Sorry Friend, ");
  231.    v_gtext(handle,6,19,"I don't have any ");
  232.    v_gtext(handle,6,27,"work for you.");
  233.    pause();
  234.   }
  235.  
  236.  
  237.   }  /* end of WORKING */
  238.    
  239. if( com == 'A' || com == 'a')   /* ask the time */
  240. check_time();
  241.  
  242.                           /* you want to rent a room */
  243. if( com == 'R' || com == 'r' )
  244.  {
  245.  
  246.  
  247.  
  248.   amount = 75 - user.con + user.lvl;
  249.   v_gtext(handle,6,11,"Ah, yes! we have the");
  250.   v_gtext(handle,6,19,"finest rooms in the ");
  251.   v_gtext(handle,6,27,"city! And what a bar-");
  252.   sprintf(string,"gain for only %d gp.",amount);
  253.   v_gtext(handle,6,35,string);
  254.   v_gtext(handle,6,51,"Still want it [y=n]");
  255.   com2 = Bconin(2);
  256.    if ( com2 == 'Y' || com2 == 'y' )
  257.      {
  258.       if (amount > user.gold) v_gtext(handle,6,59,"You dont have the funds");
  259.       /* else you do have the $$ */
  260.       else
  261.       {
  262.        user.gold -= amount;   /* debt the amount */
  263.        clear_it();
  264.  
  265.  
  266.        v_gtext(handle,6,11,"How long do you wish ");
  267.        v_gtext(handle,6,19,"to sleep [Max of 12]");
  268.        v_gtext(handle,6,35,"Up/Down arrow to change");
  269.        v_gtext(handle,6,43,"Return to confirm.");
  270.        sprintf(string,"Time:%d",sleep_time);
  271.        v_gtext(handle,6,59,string);
  272.        do
  273.        {
  274.         com2 = (char)(Bconin(2)>>16);
  275.         if(com2 == 0x48) sleep_time +=1;
  276.  if(com2 == 0x50) sleep_time -=1;
  277.  if(sleep_time < 0) sleep_time =0;
  278.  if(sleep_time > 12) sleep_time = 12;
  279.  
  280.  if( test > 9 && sleep_time == 9 )   /* if previous was > 9 and now its 9, clear */
  281.  v_gtext(handle,6,59,"               ");  /* clear */
  282.  
  283.  sprintf(string,"Time:%d",sleep_time);
  284.  v_gtext(handle,6,59,string);
  285. test = sleep_time;
  286.  }while( com2 != 0x1c); /* until return is pressed */
  287.  
  288.  
  289.        amount = sleep_time;
  290.        sleep_time = 0;
  291.        v_gtext(handle,6,67,"I'll wake you up in");
  292.        sprintf(string,"%d hours",amount);
  293.        v_gtext(handle,6,75,string);
  294.       
  295.        
  296.              /* update TIME! */
  297.        
  298.             /* mod 12, hours */
  299.      for(g=0;g<amount;g++)
  300.       {  
  301.       
  302.       time = HOUR_VALUE;   /* Dentoe an hour has passed */
  303.        sleeppause();                /* sleeping and update time at same time */
  304.        dummy=events();   /* update stuff... But SUPRESS encounter!
  305.                            ie, dummy holds 1 if encounter 0 if not,
  306.                            so just ignore it! */
  307.  
  308.       
  309.      }
  310.           
  311.  
  312.        clear_it();
  313.        v_gtext(handle,6,11,"It's time for you to ");
  314.        v_gtext(handle,6,19,"wake up, I hope you ");
  315.        v_gtext(handle,6,27,"rested well..");
  316.                                                 /* update stats */
  317.        user.hp = user.hp + (amount*user.lvl);
  318.        if(user.hp > user.max_hp) user.hp = user.max_hp;
  319.        user.sp = user.sp + (amount+(user.inte-10));
  320.        if(user.sp > user.max_sp) user.sp = user.max_sp;
  321.        pause();
  322.        
  323.       }/* end of else, you have $ to pay for it */
  324.       
  325.      } /* end of Yes i still want a room */   
  326.  
  327.  } /* end of rent a room */
  328.  
  329.  
  330.  
  331.  /* process other inputs here */
  332.  } while( com != 'E' && com != 'e');   /* Stay in estab until Exit! */
  333. } /* end of module */
  334.  
  335. /********************************************/
  336. tavern()
  337. {
  338. char com,com2;
  339. int check_random,g,amount=0,delta=0,c_time;
  340.  
  341. v_gtext(handle,197,99,"    Tavern    ");
  342.  /* execute sound of opening door..*/
  343.     invoke_tsr( open2 );
  344.   
  345. clear_it();
  346.  
  347. do       /* main do , do until select Exit! */
  348. {
  349.  
  350.  
  351.  display_user_stats();         /* update stats */
  352.  clear_it();                   /* clear screen */
  353.  
  354.  v_justified(handle,6,11,"You walk into a dimly lit",184,0,1);
  355.  v_justified(handle,6,19,"tavern. A healthy barmaid",184,0,1);
  356.  v_gtext(handle,6,27,"seats you at the bar.");
  357.  v_gtext(handle,6,35,"Finally the bartender");
  358.  v_gtext(handle,5,43,"comes over to you and");
  359.  v_gtext(handle,6,51,"says...");
  360.  v_justified(handle,6,59,"'Greetings! what may I get",184,0,1);
  361.  v_gtext(handle,6,67,"thee?'");
  362.  v_gtext(handle,6,76,"Order a (D)rink  (T)alk");
  363.  v_gtext(handle,6,84,"Order   (F)ood   (E)xit");
  364.  
  365. while (!(Bconstat(2)))
  366.   {
  367.     v_gtext(handle,78,76," "); v_gtext(handle,150,76," ");
  368.     v_gtext(handle,78,84," "); v_gtext(handle,150,84," ");
  369.  
  370.      pauser();
  371.  
  372.     v_gtext(handle,78,76,"D"); v_gtext(handle,150,76,"T");
  373.     v_gtext(handle,78,84,"F"); v_gtext(handle,150,84,"E");
  374.    pauser();
  375.  
  376.    }
  377. do
  378. {
  379.  com = Bconin(2);
  380. }
  381.  while ( com != 'D' && com !='d' && com != 'T' && com != 't' &&
  382.          com != 'F' && com !='f' && com != 'E' && com != 'e' );
  383.  
  384. clear_it();
  385.                              /* order a DRINK */
  386. if ( com == 'D' || com =='d' )
  387.   {
  388. do       /* begin of do until Exit is chosen */
  389.  {     
  390.  clear_it();
  391.    v_justified(handle,6,11,"The inkeeper says,",184,0,1);
  392.    v_gtext(handle,6,19,"Thy choice?");
  393.    v_gtext(handle,6,35,"A) Water    B) Tea");
  394.    v_gtext(handle,6,43,"C) Ale      D) Wine");
  395.    v_gtext(handle,6,51,"E) Spirits  F) Mead");
  396.    v_gtext(handle,6,59,"G) Coffee   X) Exit");
  397.  
  398. while (!(Bconstat(2)))
  399.   {
  400.     v_gtext(handle,6,35," "); v_gtext(handle,102,35," ");
  401.     v_gtext(handle,6,43," "); v_gtext(handle,102,43," ");
  402.     v_gtext(handle,6,51," "); v_gtext(handle,102,51," ");
  403.     v_gtext(handle,6,59," "); v_gtext(handle,102,59," ");
  404.  
  405.      pauser();
  406.     v_gtext(handle,6,35,"A"); v_gtext(handle,102,35,"B");
  407.     v_gtext(handle,6,43,"C"); v_gtext(handle,102,43,"D");
  408.     v_gtext(handle,6,51,"E"); v_gtext(handle,102,51,"F");
  409.     v_gtext(handle,6,59,"G"); v_gtext(handle,102,59,"X");
  410.  
  411.      pauser();
  412.  
  413.    }
  414.    do
  415.    {
  416.     com2 = Bconin(2);
  417.    }while( com2 !='A' && com2 != 'a' && com2 !='B' && com2 != 'b' &&
  418.            com2 !='C' && com2 != 'c' && com2 !='D' && com2 != 'd' &&
  419.            com2 !='E' && com2 != 'e' && com2 !='F' && com2 != 'f' &&
  420.            com2 !='G' && com2 != 'g' && com2 !='X' && com2 != 'x' );
  421.    g = abs(rnd(15)); /* the  base price of everything */
  422.    g += 20; /* the price */
  423.    clear_it();
  424.   
  425.  if( com2 != 'x' && com2 != 'X' )   /* if not exit.. */
  426.     {
  427.    sprintf(string,"It'll cost: %d gp",g);
  428.    v_gtext(handle,6,11,string);
  429.    v_gtext(handle,6,27,"Still want it [y/n]");
  430.    com=Bconin(2);
  431.    if(com == 'Y' || com == 'y')
  432.    {
  433.    if( user.gold < g ){
  434.            v_gtext(handle,6,11,"You have not the funds");
  435.            pause();
  436.                       }
  437.     else
  438.      if( com2 != 'C' && com2 != 'c') /* if ale not chosen */
  439.       {
  440.         if(com2 =='A' || com2 =='a') user.user_items[1]++;    /* store your water */
  441.         v_gtext(handle,6,11,"Enjoy your drink!");
  442.         pause();
  443.         user.gold -=g;       /* update gold */
  444.        }
  445.      
  446.         else /* else you chose to buy Ale */
  447.        {clear_it();
  448.         v_gtext(handle,6,11,"We seem to be out of");
  449.         v_gtext(handle,6,19,"Ale, do you want to go");
  450.         v_gtext(handle,6,27,"down to the cellar and");
  451.         v_gtext(handle,6,35,"get your own? [y/n]");
  452. while (!(Bconstat(2)))
  453.   {
  454.     v_gtext(handle,126,35,"   ");
  455.        pauser();
  456.     v_gtext(handle,126,35,"y/n");
  457.        pauser();
  458.    }
  459.   
  460.         com2=Bconin(2);
  461.         if( com2 == 'Y' || com2 == 'y' )
  462.            {
  463.             clear_it();
  464.               v_gtext(handle,6,11,"As you make your way");
  465.               v_gtext(handle,6,19,"down the creaky stairs");
  466.               v_gtext(handle,6,27,"You get the feeling ");
  467.               v_gtext(handle,6,35,"that this might not be");
  468.               v_gtext(handle,6,43,"such a great idea. ");
  469.               v_gtext(handle,6,51,"Finally you come upon");
  470.               v_gtext(handle,6,59,"a mighty vallenwood ");
  471.               v_gtext(handle,6,67,"door.");
  472.               v_gtext(handle,6,75,"(U) to go back up or");
  473.               v_gtext(handle,6,83,"(O) to open the door");
  474. while (!(Bconstat(2)))
  475.   {
  476.     v_gtext(handle,14,75," "); v_gtext(handle,14,83," ");   
  477.      pauser();
  478.     v_gtext(handle,14,75,"U"); v_gtext(handle,14,83,"O");
  479.      pauser();
  480.    }
  481.  
  482.               com2=Bconin(2);
  483.              clear_it();
  484.              if(com2 == 'O' || com2 == 'o')
  485.               {
  486.               v_gtext(handle,6,11,"The door opens with");
  487.               v_gtext(handle,6,19,"a mighty creak.....");
  488.               invoke_tsr( open1 );
  489.               if( user.user_items[3] == 0 )
  490.               {
  491.                v_gtext(handle,6,35,"You dont have any ");
  492.                v_gtext(handle,6,43,"torches,so you return");
  493.                v_gtext(handle,6,51,"back to the surface..");
  494.                
  495.               }
  496.               else if( user.user_items[15] == 1) /* if you've already been here.. */
  497.               {user.user_items[3]--; /* use a torch */
  498.                v_gtext(handle,6,27,"You grap a mug of");
  499.                v_gtext(handle,6,35,"ale and return up");
  500.                v_gtext(handle,6,43,"to the surface...");
  501.                
  502.               }
  503.               else
  504.               {
  505.               user.user_items[3]--;      /* use up a torch.. */
  506.               v_gtext(handle,6,27,"The cellar reeks of");
  507.               v_gtext(handle,6,35,"the musty odor of ");
  508.               v_gtext(handle,6,43,"stale beer. You spot");
  509.               v_gtext(handle,6,51,"the keg of ale and ");
  510.               v_gtext(handle,6,59,"head towards it.... ");
  511.               v_gtext(handle,6,67,"As you apporach the ");
  512.               v_gtext(handle,6,83,"anykey to continue.");
  513.               com2=Bconin(2);
  514.               clear_it();
  515.               v_gtext(handle,6,11,"keg, something moves!");
  516.               v_gtext(handle,6,19,"You go over to invest");
  517.               v_gtext(handle,6,27,"igate...As you near  ");
  518.               v_gtext(handle,6,35,"the far corner of the");
  519.               v_gtext(handle,6,43,"cellar, a deformed");
  520.               v_gtext(handle,6,51,"looking person steps");
  521.               v_gtext(handle,6,59,"out of the shadows.. ");
  522.               v_gtext(handle,6,67,"It speaks,    ");
  523.               v_gtext(handle,6,83,"anykey to continue");
  524.               com2=Bconin(2);
  525.               clear_it();
  526.               v_gtext(handle,6,11,"'Hail stranger..  ");
  527.               v_gtext(handle,6,19,"I must be quick and");
  528.               v_gtext(handle,6,27,"brief for much is at");
  529.               v_gtext(handle,6,35,"stake! My enemies are");
  530.               v_gtext(handle,6,43,"many and spies are ");
  531.               v_gtext(handle,6,51,"everywhere...");
  532.               v_gtext(handle,6,59,"You must run the ");
  533.               v_gtext(handle,6,67,"Guantlet brave one!");
  534.               v_gtext(handle,6,83,"press anykey.");
  535.               com2=Bconin(2);
  536.               clear_it();
  537.               v_gtext(handle,6,11,"For the time of ");
  538.               v_gtext(handle,6,19,"reckoning is    ");
  539.               v_gtext(handle,6,27,"finally at hand!");
  540.               v_gtext(handle,6,35,"He hands you a ");
  541.               v_gtext(handle,6,43,"potion and then ");
  542.               v_gtext(handle,6,51,"disappears....");
  543.               user.user_items[10]++;  /* add a protection potion */
  544.               user.user_items[15] = 1; /* set flag to tell that you have met this man */
  545.               v_gtext(handle,6,67,"press anykey");
  546.               com2=Bconin(2);
  547.               clear_it();  
  548.               v_gtext(handle,6,11,"You pocket the ");
  549.               v_gtext(handle,6,19,"potion and head");
  550.               v_gtext(handle,6,27,"back up the stairs");
  551.               
  552.               }
  553.              }
  554.            
  555.            }
  556.         else {v_gtext(handle,6,51,"Sorry for the ");
  557.               v_gtext(handle,6,59,"inconvience..");}
  558.         pause();
  559.        }
  560.       clear_it();
  561.      }
  562.      display_user_stats();         /* update stats */
  563.     
  564.    } /* end of Yes I  want to buy */ 
  565.  }while(com2 != 'x' && com2 != 'X');   /* end of do until Exit chosen */
  566.  } /* end of order a drink */
  567.  
  568.                                /* ORDER FOOD */
  569.  
  570. if ( com == 'F' || com =='f' )
  571.   {
  572. do       /* begin of do until Exit is chosen */
  573.  {     
  574. clear_it();
  575.    v_justified(handle,6,11,"The inkeeper says,",184,0,1);
  576.    v_gtext(handle,6,19,"Thy choice?");
  577.    v_gtext(handle,6,35,"A) Bread     B) Soup");
  578.    v_gtext(handle,6,43,"C) Sandwich  D) Pasta");
  579.    v_gtext(handle,6,51,"E) Chicken   F) Lamb");
  580.    v_gtext(handle,6,59,"G) Quail     X) Exit");
  581. while (!(Bconstat(2)))
  582.   {
  583.     v_gtext(handle,6,35," "); v_gtext(handle,110,35," ");
  584.     v_gtext(handle,6,43," "); v_gtext(handle,110,43," ");
  585.     v_gtext(handle,6,51," "); v_gtext(handle,110,51," ");
  586.     v_gtext(handle,6,59," "); v_gtext(handle,110,59," ");
  587.  
  588.      pauser();
  589.     v_gtext(handle,6,35,"A"); v_gtext(handle,110,35,"B");
  590.     v_gtext(handle,6,43,"C"); v_gtext(handle,110,43,"D");
  591.     v_gtext(handle,6,51,"E"); v_gtext(handle,110,51,"F");
  592.     v_gtext(handle,6,59,"G"); v_gtext(handle,110,59,"X");
  593.  
  594.      pauser();
  595.  
  596.    }
  597.  
  598.    do
  599.    {
  600.     com2 = Bconin(2);
  601.    }while( com2 !='A' && com2 != 'a' && com2 !='B' && com2 != 'b' &&
  602.            com2 !='C' && com2 != 'c' && com2 !='D' && com2 != 'd' &&
  603.            com2 !='E' && com2 != 'e' && com2 !='F' && com2 != 'f' &&
  604.            com2 !='G' && com2 != 'g' && com2 !='X' && com2 != 'x' );
  605.    g = abs(rnd(40)); /* the  base price of everything */
  606.    g += 15;  /* the price */
  607.    clear_it();
  608.    
  609.       if( com2 != 'x' && com2 != 'X' )
  610.        {
  611.    sprintf(string,"It'll cost: %d gp",g);
  612.    v_gtext(handle,6,11,string);
  613.    v_gtext(handle,6,27,"Still want it [y/n]");
  614.    com=Bconin(2);
  615.    if(com == 'Y' || com == 'y')
  616.    {
  617.   
  618.      if( user.gold < g ) v_gtext(handle,6,11,"You dont have the funds");
  619.       else
  620.        {
  621.         switch(com2)
  622.           {
  623.            case 'a':case 'A': user.user_items[0]++;break;
  624.            case 'b':case 'B': 
  625.            case 'c':case 'C': user.user_items[0]+=2;break;
  626.            case 'd':case 'D': user.user_items[0]+=3;break;
  627.            case 'e':case 'E': user.user_items[0]+=5;break;
  628.            case 'g':case 'G': user.user_items[0]+=5;break;
  629.  
  630.           }
  631.         v_gtext(handle,6,11,"Enjoy your food....");
  632.         user.gold -=g;       /* update gold */
  633.         pause();
  634.        }
  635.       clear_it();
  636.       display_user_stats();
  637.       }
  638.      
  639.    } /* end of yes i want to buy */
  640.  }while(com2 != 'X' && com2 != 'x');   /* end of do until Exit chosen */
  641.  } /* end of order FOOD */
  642.  
  643.  
  644.                                      /* TALK */
  645. if ( com == 'T' || com =='t' )
  646.  {
  647.  
  648. long int deposit_amount=0,temper;
  649.  char com;
  650.  int test=0;   /* if previous was 10 or > and then you went to 9.. clear */
  651.  
  652.  clear_it();
  653.  v_gtext(handle,6,11,"Your coins in copper:");
  654.  sprintf(string,"<%ld>",user.gold);
  655.  v_gtext(handle,6,19,string);
  656.  sprintf(string,"Bribe:%ld",deposit_amount);
  657.  v_gtext(handle,6,35,string);
  658.  v_gtext(handle,6,51,"Up arrow to increase");
  659.  v_gtext(handle,6,59,"Down arrow to decrease");
  660.  v_gtext(handle,6,67,"<Return> to confirm");
  661.  v_gtext(handle,6,75,"bribe."); 
  662. do
  663.  {
  664.  com2 = (char)(Bconin(2)>>16);
  665.  if(com2 == 0x48) deposit_amount +=1;
  666.  if(com2 == 0x50) deposit_amount -=1;
  667.  if(deposit_amount < 0) deposit_amount =0;
  668.  if(deposit_amount > user.gold) deposit_amount = user.gold;
  669. temper = user.gold - deposit_amount;
  670. sprintf(string,"<%ld>",temper);
  671.  v_gtext(handle,6,19,string); 
  672. if( test > 9 && deposit_amount == 9 || 
  673.      test > 99 && deposit_amount == 99)   /* if previous was > 9 and now its 9, clear */
  674.  v_gtext(handle,6,35,"               ");  /* clear */
  675.  sprintf(string,"Bribe:%ld",deposit_amount);
  676.  v_gtext(handle,6,35,string);
  677. test = deposit_amount;
  678.  }while( com2 != 0x1c); /* until return is pressed */
  679. user.gold -=deposit_amount;  /* update user gold */
  680.  
  681.  
  682. clear_it();
  683.  
  684.   if(deposit_amount < 10) { v_gtext(handle,6,11,"I would't roam the City");
  685.                        v_gtext(handle,6,19,"at night.");}
  686.   else if(deposit_amount < 25) { v_gtext(handle,6,11,"Swords are worth their");
  687.                        v_gtext(handle,6,19,"weight in gold.");}
  688.    else if(deposit_amount < 55) { v_gtext(handle,6,11,"Sell Gems/Jewels at");
  689.                        v_gtext(handle,6,19,"the Bank.");}
  690.    else if(deposit_amount < 75) { v_gtext(handle,6,11,"Don't give up on the");
  691.                        v_gtext(handle,6,19,"Guilds, you will be");
  692.                        v_gtext(handle,6,27,"worthy of them some");
  693.                        v_gtext(handle,6,35,"day....");
  694.                         } 
  695.     else if(deposit_amount < 100) { v_gtext(handle,6,11,"Go visit the Castle.");
  696.                          }
  697.      else if(deposit_amount < 155) { v_gtext(handle,6,11,"Behind the Gates lie");
  698.                        v_gtext(handle,6,19,"wonderous mysteries to");
  699.                         v_gtext(handle,6,27,"unravel...");
  700.                          }
  701.     else if(deposit_amount < 230) { v_gtext(handle,6,11,"Our Ale is the best");
  702.                        v_gtext(handle,6,19,"in the Region!");}
  703.     else if(deposit_amount < 300) { v_gtext(handle,6,11,"Timepieces are invaluable.");
  704.                        }
  705.  
  706.           
  707.         
  708.  
  709. pause();
  710.  
  711.  } /* end of TALK */
  712.  
  713.                               
  714.  } while( com != 'E' && com != 'e');   /* Stay in estab until Exit! */
  715.  
  716. }
  717.  
  718.  
  719.  
  720. guild()
  721. {
  722. char com,com2;
  723. int prev = 0;
  724.  
  725. v_gtext(handle,197,99,"    Guild     ");
  726.  /* execute sound of opening door..*/
  727.     invoke_tsr( open2 );
  728. clear_it();
  729.  
  730.  
  731. do       /* main do , do until select Exit! */
  732. {
  733.  
  734.  
  735.  display_user_stats();         /* update stats */
  736.  clear_it();                   /* clear screen */
  737.  
  738.  v_justified(handle,6,11,"The Guildmaster greets",184,0,1);
  739.  v_gtext(handle,6,19,"you....");
  740.  
  741.  v_gtext(handle,6,35,"Welcome Seeker! What");
  742.  v_gtext(handle,5,43,"may I do for you?");
  743.  v_gtext(handle,6,59,"(J)oin our Guild  ");
  744.  v_gtext(handle,6,67,"(R)emove All Curses");
  745.  v_gtext(handle,6,75,"(E)xit");
  746. while (!(Bconstat(2)))
  747.   {
  748.     v_gtext(handle,14,59," "); v_gtext(handle,14,67," ");
  749.     v_gtext(handle,14,75," ");
  750.      pauser();
  751.     v_gtext(handle,14,59,"J"); v_gtext(handle,14,67,"R");
  752.     v_gtext(handle,14,75,"E");
  753.      pauser();
  754.  
  755.    }
  756.  
  757.    com = Bconin(2); 
  758.  
  759.     clear_it();
  760.      
  761.  
  762.                         /* Remove curses */
  763.        if ( com == 'R' || com =='r' )
  764.       {
  765.  
  766.       v_justified(handle,6,11,"The Guildmaster says,",184,0,1);
  767.       v_gtext(handle,6,19,"My services cost 1000gp");
  768.       v_gtext(handle,6,27,"to remove curses.");
  769.       v_gtext(handle,6,43,"Accept?  [y/n]");
  770.   while (!(Bconstat(2)))
  771.   {
  772.     v_gtext(handle,86,43,"   "); 
  773.      pauser();
  774.     v_gtext(handle,86,43,"y/n"); 
  775.      pauser();
  776.    }
  777.  
  778.        do
  779.       {
  780.        com2 = Bconin(2);
  781.       }while( com2 !='N' && com2 != 'n' && com2 !='Y' && com2 != 'y');
  782.       if( com2 == 'Y' || com2 == 'y')
  783.        { 
  784.          clear_it();
  785.      if( user.user_items[16] == 0 )  /* if you are NOT cursed! */
  786.        v_gtext(handle,6,11,"You are not cursed.");
  787.       else
  788.      {
  789.       if( user.gold < 1000 ) v_gtext(handle,6,11,"You dont have the funds");
  790.        else
  791.        {
  792.         user.gold -=1000;
  793.         user.user_items[16] = 0; /* set so no more curses */
  794.         v_gtext(handle,6,19,"I have cured you...");
  795.        }
  796.       } /* end of if Yes chosen */
  797.      } /* end of else you are cursed.. */
  798.     } /* end of Remove Curses */
  799.  
  800.                                /* Join Guild */
  801.  
  802. if ( com == 'J' || com =='j' )
  803.   {
  804.   v_justified(handle,6,11,"The Guildmaster says,",184,0,1);
  805.  
  806.    if( user.user_items[17] == 1 )   /* if your already a member */
  807.     {                                      
  808.       v_gtext(handle,6,19,"You are already a");
  809.       v_gtext(handle,6,27,"member...");
  810.     }
  811.    else if( user.user_items[19] && user.user_items[17] != 1 )   /* if you have the ring... */
  812.     {                                        /* and you're not already a member */
  813.       v_gtext(handle,6,19,"Ah Seeker!    ");
  814.       v_gtext(handle,6,27,"You have proved your");
  815.       v_gtext(handle,6,35,"self and we welcome");
  816.       v_gtext(handle,6,43,"you into our Order.");
  817.       user.user_items[17] = 1; /* now your a member... */
  818.     }
  819.   else
  820.    {
  821.    v_gtext(handle,6,19,"Sorry, We are not ");
  822.    v_gtext(handle,6,27,"accepting new members");
  823.    v_gtext(handle,6,35,"at this time...");
  824.    }
  825.    pause();
  826.  } /* end of join Guild */
  827.  
  828.  
  829. }while(com != 'E' && com != 'e');
  830.  
  831. } /* end of Guild */
  832.  
  833.  
  834.  
  835.  
  836. weapon()
  837. {
  838.  
  839. v_gtext(handle,197,99,"   Weaponry   ");
  840.  /* execute sound of opening door..*/
  841.     invoke_tsr( open2 );
  842.   
  843.  }
  844.  
  845. armour()
  846. {
  847.  
  848. v_gtext(handle,197,99,"    Armory    ");
  849.  /* execute sound of opening door..*/
  850.     invoke_tsr( open2 );
  851.   
  852. }
  853.  
  854. castle(mf_src,mf_dest,pxyarray,scr5)
  855. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  856. char *scr5; /* misc3.dat */
  857. int pxyarray[8];
  858.  
  859. {
  860.         /* you can be healed 20 times max! */
  861.         int s_ave[4],f;
  862.  
  863. clear_it();
  864.  
  865. v_gtext(handle,197,99,"    Castle    ");
  866. if(user.user_items[18] == 1)
  867.  {
  868.   v_gtext(handle,6,11,"The king will not see");
  869.   v_gtext(handle,6,19,"you anymore.");
  870.  }
  871.  
  872. if(user.user_items[18] == 0)
  873.  
  874. for(f=0;f<4;f++) s_ave[f] = pxyarray[f]; /*save array */
  875.  
  876.             mf_src->fd_addr = (long) scr5; /* copy address */
  877.    
  878.            pxyarray[0] = 70;
  879.       pxyarray[1] = 93;  /* get the src rectangle */
  880.       pxyarray[2] = 192;
  881.       pxyarray[3] = 181; 
  882.       
  883.          
  884.  
  885.  
  886.  
  887.  
  888.  
  889.       
  890.       
  891.  
  892.       if( user.user_items[20] == 0  )        /* do this ONLY ONCE! */
  893.      {                
  894.        user.user_items[20] = 1;
  895.        v_gtext(handle,6,11,"As you enter the Castle");
  896.        v_gtext(handle,6,19,"you can't help but ");
  897.        v_gtext(handle,6,27,"notice the Honor Guard");
  898.        v_gtext(handle,6,35,"that keeps watch over");
  899.        v_gtext(handle,6,43,"everyone who enters..");
  900.        v_gtext(handle,6,51,"You pass by statues of");
  901.        v_gtext(handle,6,59,"great warriors, past ");
  902.        v_gtext(handle,6,67,"kings and strange and ");
  903.        v_gtext(handle,6,75,"mysterious monsters.");
  904.        pause(); clear_it();
  905.      
  906.        v_gtext(handle,6,11,"Finally you come to the");
  907.        v_gtext(handle,6,19,"entrance of the Throne");
  908.        v_gtext(handle,6,27,"Room.");
  909.        v_gtext(handle,6,35,"Guarding the entrance ");
  910.        v_gtext(handle,6,43,"is the Captain of the ");
  911.        v_gtext(handle,6,51,"Guard. He looks at you,");
  912.        v_gtext(handle,6,59,"seems to begin to say ");
  913.        v_gtext(handle,6,67,"something, but he just");
  914.        v_gtext(handle,6,75,"nods his head to you ");
  915.        v_gtext(handle,6,83,"and opens the door....");
  916.        pause();
  917.        invoke_tsr( open1 );
  918.        clear_it();
  919.  
  920.        vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  921.  
  922.        v_gtext(handle,6,11,"As you enter the Throne");
  923.        v_gtext(handle,6,19,"Room, you see pages and");
  924.        v_gtext(handle,6,27,"couriers going about");
  925.        v_gtext(handle,6,35,"their daily business.");
  926.        v_gtext(handle,6,43,"Suddenly the king ");
  927.        v_gtext(handle,6,51,"shouts   'SILENCE!!'");
  928.        v_gtext(handle,6,59,"The room becomes very");
  929.        v_gtext(handle,6,67,"quiet and all eyes turn");
  930.        v_gtext(handle,6,75,"towards you......" );
  931.        pause(); clear_it();
  932.       
  933.        v_gtext(handle,6,11,"The King speaks,");
  934.        v_gtext(handle,6,19,"'Greetings");
  935.        v_gtext(handle,6,27,user.name);
  936.        v_gtext(handle,6,35,"'Come foreword...'");
  937.        v_gtext(handle,6,43,"You cautiously approach");
  938.        v_gtext(handle,6,51,"the throne.");
  939.        v_gtext(handle,6,59,"As you approach the ");
  940.        v_gtext(handle,6,67,"throne, he talks:");
  941.        v_gtext(handle,6,75,"'I need a Champion, but");
  942.        v_gtext(handle,6,84,"thou are not ready. Go");
  943.           pause(); clear_it();
  944.        v_gtext(handle,6,11,"and master your chosen");
  945.        v_gtext(handle,6,19,"profession and become");
  946.        v_gtext(handle,6,27,"wiser and stronger...");
  947.        v_gtext(handle,6,35,"Then return to me.'");
  948.       
  949.        v_gtext(handle,6,43,"You bow to the King and");
  950.        v_gtext(handle,6,51,"make a hasty retreat ");
  951.        v_gtext(handle,6,59,"outside....");
  952.         
  953.    }
  954.     
  955.    else
  956.       {
  957.         if(user.user_items[17]  && user.user_items[18]==0) {
  958.                             vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  959.  
  960.                             v_gtext(handle,6,11,"The King speaks...");
  961.                             pause(); clear_it();
  962.                            v_gtext(handle,6,11,"Thou hast show thy");
  963.                            v_gtext(handle,6,19,"courage and valor.");
  964.                            v_gtext(handle,6,27,"Thou are now ready..");
  965.                            v_gtext(handle,6,35,"Take this talisman, It");
  966.                            v_gtext(handle,6,43,"will allow you to pass");
  967.                            v_gtext(handle,6,51,"through the entrance");
  968.                            v_gtext(handle,6,59,"that leads to the");
  969.                            v_gtext(handle,6,67,"Catacombs that lie");
  970.                            v_gtext(handle,6,75,"beneath the City.");
  971.                            pause(); clear_it();
  972.                            v_gtext(handle,6,11,"There you may find");
  973.                            v_gtext(handle,6,19,"your destiny......");
  974.                            
  975.                             v_gtext(handle,6,35,"As you take the rod,");
  976.                            if( (strcmp(user.align,"Good")) == 0)
  977.                            { 
  978.                            v_gtext(handle,6,43,"you shudder at the ");
  979.                            v_gtext(handle,6,51,"malignant evil that");
  980.                            v_gtext(handle,6,59,"emits from the ancient");
  981.                            v_gtext(handle,6,67,"artifact");
  982.                            user.hp = user.hp - 5L;
  983.                            }
  984.                            else
  985.                            {
  986.                            v_gtext(handle,6,43,"a feeling of power");
  987.                            v_gtext(handle,6,51,"courses through your");
  988.                            v_gtext(handle,6,59,"body...");
  989.                            }
  990.                            v_gtext(handle,6,75,"You bow to the King");
  991.                            v_gtext(handle,6,83,"and leave the castle.");
  992.                            user.user_items[18] = 1; /* lets you pass
  993.                                                         into the dungeon */
  994.  
  995.                      } /* end of you are worthy */
  996.                            
  997.                            
  998.         else
  999.           {
  1000.            if( user.hp == user.max_hp)
  1001.            {
  1002.            vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  1003.  
  1004.            v_gtext(handle,6,11,"You are not yet ");
  1005.            v_gtext(handle,6,19,"worthy...");
  1006.            }
  1007.            else if( user.way < 21)
  1008.                  { 
  1009.                    vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  1010.                    v_gtext(handle,6,11,"The King speaks..");
  1011.                    v_gtext(handle,6,19,"Let me heal thy wounds");
  1012.                    v_gtext(handle,6,27,user.name);
  1013.                    user.way++;  /* max 20 times to be healed */  
  1014.                    user.hp = user.max_hp;
  1015.                  }
  1016.           }
  1017.  
  1018.       }
  1019.     for(f=0;f<4;f++)  pxyarray[f]= s_ave[f]; /*restore array */
  1020.   pause();
  1021.  } /* end of if user.useritems[18] == 0 */
  1022.  
  1023. } /* end of castle */
  1024.  
  1025.  
  1026. supply()
  1027. {
  1028.                        
  1029. v_gtext(handle,197,99,"   Supply     ");
  1030.  /* execute sound of opening door..*/
  1031.      invoke_tsr( open2 );
  1032.   
  1033.  
  1034.  
  1035. }
  1036.  
  1037. tower(mf_src,mf_dest,pxyarray,scr6,scr4)
  1038. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  1039. char *scr6,*scr4; /* misc3.dat */
  1040. int pxyarray[8];
  1041.  
  1042. {
  1043. char com;
  1044. int run;  /* set this for encounter, to tell it to load up
  1045.                  the demon lord you'll fight */
  1046. static int been_here = 0;
  1047.  
  1048. v_gtext(handle,197,99,"    Tower     ");
  1049. clear_it();
  1050.  
  1051.  if( !been_here )
  1052.       {
  1053.        v_gtext(handle,6,11,"You open the gate ");
  1054.        v_gtext(handle,6,19,"that leads to the");
  1055.        v_gtext(handle,6,27,"courtyard. Finally");
  1056.        v_gtext(handle,6,35,"you spot the mighty");
  1057.        v_gtext(handle,6,43,"door that is the towers");
  1058.        v_gtext(handle,6,51,"only entrance....");
  1059.        v_gtext(handle,6,59,"You make haste and open");
  1060.        v_gtext(handle,6,67,"the door.");
  1061.        invoke_tsr( open1 );
  1062.        pause(); clear_it();
  1063.         mf_src->fd_addr = (long) scr4; /* copy address */
  1064.    
  1065.            pxyarray[0] = 70;
  1066.       pxyarray[1] = 93;  /* get the src rectangle */
  1067.       pxyarray[2] = 192;
  1068.       pxyarray[3] = 181; 
  1069.          
  1070.           vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  1071.  
  1072.  
  1073.        v_gtext(handle,6,11,"Once inside you find");
  1074.        v_gtext(handle,6,19,"yourself in the private");
  1075.        v_gtext(handle,6,27,"audience chamber of the");
  1076.        v_gtext(handle,6,35,"Wizard, Wall hangings ");
  1077.        v_gtext(handle,6,43,"depicting great battles");
  1078.        v_gtext(handle,6,51,"and arcane symols, hang");
  1079.        v_gtext(handle,6,59,"on walls made of dark"); 
  1080.        v_gtext(handle,6,67,"panneling. The floor ");
  1081.        v_gtext(handle,6,75,"seems to be made of ");
  1082.        v_gtext(handle,6,83,"smooth black marble. ");
  1083.         pause(); clear_it();
  1084.         v_gtext(handle,6,11,"As you continue to ");
  1085.        v_gtext(handle,6,19,"admire the surroundings");
  1086.        v_gtext(handle,6,27,"you notice a body ");
  1087.        v_gtext(handle,6,35,"lying in the middle of");
  1088.        v_gtext(handle,6,43,"The room. You go over");
  1089.        v_gtext(handle,6,51,"to investigate....");
  1090.        v_gtext(handle,6,59,"As you come up to the");
  1091.        v_gtext(handle,6,67,"body, you notice that");
  1092.        v_gtext(handle,6,75,"it lies a in circle ");
  1093.        v_gtext(handle,6,83,"with arcane symbols all");
  1094.       pause(); clear_it();
  1095.         v_gtext(handle,6,11,"along its perimiter.");
  1096.       
  1097.        v_gtext(handle,6,27,"Do you wish to enter?");
  1098.        v_gtext(handle,6,35,"[Y/N]");
  1099.        if ( (com=Bconin(2)) == 'Y' || (com == 'y' ))
  1100.        {       
  1101.        v_gtext(handle,6,43,"As you attempt to step");
  1102.        v_gtext(handle,6,51,"inside the circle, ");
  1103.        v_gtext(handle,6,59,"you get a mighty shock"); 
  1104.        v_gtext(handle,6,67,"as some unseen force ");
  1105.        v_gtext(handle,6,75,"prevents you from ");
  1106.        v_gtext(handle,6,83,"entering..");
  1107.        user.hp -=5; if(user.hp <= 0){ clear_it(); v_gtext(handle,6,11,"you died.."); exit(1);}
  1108.        pause(); clear_it();
  1109.        v_gtext(handle,6,11,"A high pitched wail");
  1110.        v_gtext(handle,6,19,"shudders your entire ");
  1111.        v_gtext(handle,6,27,"being..Mabey entering");
  1112.        v_gtext(handle,6,35,"the circle wasn't such ");
  1113.        v_gtext(handle,6,43,"a great idea...");
  1114.        v_gtext(handle,6,51,"The air begins to  ");
  1115.        v_gtext(handle,6,59,"shimmer in front of you"); 
  1116.        v_gtext(handle,6,67,"Suddenly, before your");
  1117.        v_gtext(handle,6,75,"eyes, a portal appears");
  1118.        v_gtext(handle,6,83,"and out of it stepps a");
  1119.        pause(); clear_it();
  1120.         v_gtext(handle,6,11,"mighty demon!");
  1121.        
  1122.        v_gtext(handle,6,27,"It speaks,");
  1123.        v_gtext(handle,6,35,"'Foolish mortal!! Do ");
  1124.        v_gtext(handle,6,43,"you dare free my ");
  1125.        v_gtext(handle,6,51,"prisoner? For you ");
  1126.        v_gtext(handle,6,59,"shall pay dearly ");
  1127.        v_gtext(handle,6,67,"indeed........      ");
  1128.        run = -999; /* set flag for encounter */
  1129.        encounter(mf_src,mf_dest,pxyarray,scr6,&run);
  1130.        /* if you get back to this point, you defeated him.. */
  1131.        clear_it();
  1132.        if( !run )   /* if you did not run */
  1133.        {            
  1134.        v_gtext(handle,6,11,"You slump to the ");
  1135.        v_gtext(handle,6,19,"floor, barely able to"); 
  1136.        v_gtext(handle,6,27,"breathe. The room ");
  1137.        v_gtext(handle,6,35,"begins to spin around ");
  1138.        v_gtext(handle,6,43,"you as slip into uncon-");
  1139.        v_gtext(handle,6,51,"ciousness...");
  1140.       
  1141.        pause(); clear_it();
  1142.        v_gtext(handle,6,11,"You have a deep, ");
  1143.        v_gtext(handle,6,19,"troubled sleep. You"); 
  1144.        v_gtext(handle,6,27,"dream of dragons and");
  1145.        v_gtext(handle,6,35,"worse. A figure in  ");
  1146.        v_gtext(handle,6,43,"white robes appears ");
  1147.        v_gtext(handle,6,51,"before you, he speaks");
  1148.       
  1149.        v_gtext(handle,6,67,"'Hail, Brave One!   ");
  1150.        v_gtext(handle,6,75,"I am Lomir,    "); 
  1151.        v_gtext(handle,6,83,"you have freed me from");
  1152.        
  1153.        pause(); clear_it();
  1154.        v_gtext(handle,6,11,"my tormentor, the  ");
  1155.        v_gtext(handle,6,19,"Great Demon Lord, "); 
  1156.        v_gtext(handle,6,27,"Ziarat. I owe you  ");
  1157.        v_gtext(handle,6,35,"my life, and more..");
  1158.        v_gtext(handle,6,43,"After your battle, ");
  1159.        v_gtext(handle,6,51,"you died from the ");
  1160.       v_gtext(handle,6,59,"wounds you recieved. ");   
  1161.        v_gtext(handle,6,67,"I have been working");
  1162.        v_gtext(handle,6,75,"for days, trying to ");
  1163.        
  1164.        pause();clear_it();
  1165.        v_gtext(handle,6,11,"create a spell that");
  1166.        v_gtext(handle,6,19,"will bring you back"); 
  1167.        v_gtext(handle,6,27,"to the world of the");
  1168.        v_gtext(handle,6,35,"living. At last I ");
  1169.        v_gtext(handle,6,43,"have succeded, I ");
  1170.        v_gtext(handle,6,51,"give you this ring,");
  1171.       v_gtext(handle,6,59,"Take it to one of the");   
  1172.        v_gtext(handle,6,67,"Guilds and you will");
  1173.        v_gtext(handle,6,75,"be rewarded..");
  1174.        
  1175.        pause();clear_it();
  1176.        v_gtext(handle,6,11,"Know that there are");
  1177.        v_gtext(handle,6,19,"catacombs below the"); 
  1178.        v_gtext(handle,6,27,"City. The only way ");
  1179.        v_gtext(handle,6,35,"below is near my ");
  1180.        v_gtext(handle,6,43,"tower but it is ");
  1181.        v_gtext(handle,6,51,"protected by an ");
  1182.       v_gtext(handle,6,59,"ancient spell that ");   
  1183.        v_gtext(handle,6,67,"blocks anyone from ");
  1184.        v_gtext(handle,6,75,"entering. Make haste");
  1185.        
  1186.        pause();clear_it();
  1187.        v_gtext(handle,6,11,"for we have little ");
  1188.        v_gtext(handle,6,19,"time left!");
  1189.        
  1190.        v_gtext(handle,6,35,"Lomir begins to ");
  1191.        v_gtext(handle,6,43,"chant and you are");
  1192.        v_gtext(handle,6,51,"teleported to....");
  1193.       pause();
  1194.       invoke_tsr( CAST );
  1195.        user.user_items[19] = 1; /* ring */
  1196.        x = 6;
  1197.        y = 11;    /* teleport you here */
  1198.        dir = 'E'; 
  1199.        been_here = 1; /* flag, so you will not see this ever again */
  1200.        } /* end of you defeated monster abnd didnt run */
  1201.        else
  1202.          {
  1203.          clear_it();
  1204.             v_gtext(handle,6,11,"As you attempt to run");
  1205.             v_gtext(handle,6,19,"for your life, you ");
  1206.             v_gtext(handle,6,27,"feel a talon impail");
  1207.             v_gtext(handle,6,35,"you...The last thing");
  1208.             v_gtext(handle,6,43,"you head before you die");
  1209.             v_gtext(handle,6,51,"is an evil laughter...");
  1210.             user.hp = 0;
  1211.             pause();
  1212.             exit(0);
  1213.          }
  1214.        }
  1215.        
  1216.    } /* end of ! been_here */
  1217.    
  1218.  else
  1219.     v_gtext(handle,6,11,"The Tower is empty.....");
  1220.  
  1221.  
  1222.   
  1223.  
  1224. }
  1225.  
  1226. outside()
  1227. {}
  1228.  
  1229. enter_room(mf_src,mf_dest,pxyarray,scr6)
  1230. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  1231. char *scr6;
  1232. int pxyarray[8];
  1233. {
  1234.   int anyone_home;
  1235.   char com;
  1236.  
  1237.   clear_it();
  1238.   v_justified(handle,6,19,"You open the door and.....",184,0,1);
  1239.    /* execute sound of opening door..*/
  1240.     invoke_tsr( open1 );
  1241.   
  1242.  
  1243.    /* load up inside house pic here! */
  1244.    anyone_home = pos_rnd(100);
  1245.   
  1246.     if (anyone_home > 90 )    /* someone is here */
  1247.      {
  1248.       v_gtext(handle,6,19,"As you charge through");
  1249.       v_gtext(handle,6,27,"the door, you feel an");
  1250.       v_gtext(handle,6,35,"evil presence.");
  1251.       v_gtext(handle,6,59," press any key");
  1252.      
  1253.        com =Bconin(2); 
  1254.        encounter(mf_src,mf_dest,pxyarray,scr6,&anyone_home);
  1255.       } 
  1256.     else 
  1257.        {
  1258.        v_justified(handle,6,27,"The house is empty.",184,0,1);
  1259.         v_gtext(handle,6,59," press any key");
  1260.      
  1261.         com =Bconin(2); 
  1262.       
  1263.        }
  1264. }
  1265.  
  1266. /** 
  1267.    arena()
  1268. **/
  1269.  
  1270.  
  1271. arena(mf_src,mf_dest,pxyarray,scr3,scr6)
  1272. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  1273. char *scr3,*scr6; /* addrs of gate.dat and misc3.dat */
  1274. int pxyarray[8];
  1275. {
  1276.  char com;
  1277.  int run = 0 ; /* if 1 then you ran from a monster in the gauntlet */
  1278.  
  1279.  v_gtext(handle,197,99,"     Arena     ");
  1280.  
  1281. do
  1282. {
  1283.  v_gtext(handle,6,11,"You boldly enter the ");
  1284.  v_gtext(handle,6,19,"Arena. There are many");
  1285.  v_gtext(handle,6,27,"Warriors milling about,");
  1286.  v_gtext(handle,6,35,"awaiting their turn.");
  1287.  v_gtext(handle,6,51,"The clerk that is ");
  1288.  v_gtext(handle,6,59,"sitting behind a desk");
  1289.  v_gtext(handle,6,67," says, 'Next!' and you");
  1290.  v_gtext(handle,6,75,"step up...");
  1291.  v_gtext(handle,6,83,"  <Hit any key..>");
  1292.  com = Bconin(2);
  1293.  clear_it();
  1294.  v_gtext(handle,6,11,"He looks you over and");
  1295.  v_gtext(handle,6,19,"says 'whatcha want?'");
  1296.  v_gtext(handle,6,35,"R)un the Guantlet");
  1297.  v_gtext(handle,6,43,"B)et on a Battle ");
  1298.  v_gtext(handle,6,51,"T)raining        ");
  1299.  v_gtext(handle,6,59,"E)xit            ");
  1300. while (!(Bconstat(2)))
  1301.   {
  1302.     v_gtext(handle,6,35," "); 
  1303.     v_gtext(handle,6,43," "); 
  1304.     v_gtext(handle,6,51," "); 
  1305.     v_gtext(handle,6,59," "); 
  1306.  
  1307.      pauser();
  1308.     v_gtext(handle,6,35,"R");
  1309.     v_gtext(handle,6,43,"B"); 
  1310.     v_gtext(handle,6,51,"T"); 
  1311.     v_gtext(handle,6,59,"E"); 
  1312.  
  1313.      pauser();
  1314.  
  1315.    }
  1316.  
  1317. do
  1318. {
  1319.  com = Bconin(2);
  1320. }
  1321.  while ( com != 'R' && com !='r' && com != 'B' && com != 'b' &&
  1322.          com != 'T' && com !='t' && com != 'E' && com != 'e'  );
  1323.  
  1324. if( com != 'E' && com != 'e' )    /* if exit not picked .. */
  1325.   {
  1326.    if(com == 'R' || com == 'r' )
  1327.    { run=gauntlet(mf_src,mf_dest,pxyarray,scr6);
  1328.        if( run == 1 ) com = 'E'; /* so you'l be thrown out! */
  1329.    }
  1330.    if(com == 'B' || com == 'b' )
  1331.     bet();
  1332.    if(com == 'T' || com == 't' )
  1333.     training();
  1334.  
  1335.    } /* end of exit not picked  */
  1336.  
  1337. }while (com != 'E' && com != 'e' );
  1338.  
  1339.  
  1340. }
  1341.  
  1342. /** Run gauntlet 
  1343.  
  1344.     You must fight 10 monsters in a row before you have an option
  1345.     to quit. Counter % 10 tests for this.
  1346. **/
  1347. gauntlet(mf_src,mf_dest,pxyarray,scr6)
  1348. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  1349. char *scr6;
  1350. int pxyarray[8];
  1351. {
  1352.  int counter=0;    /* the gauntlet count. If you kill 50 monsters.
  1353.                       you ran the gauntlet.. */
  1354.  char com;
  1355.  int exit = 0;    /* you must fight 10 monsters in a row before 
  1356.                   you have an option to quit! Thus Counter%10
  1357.                   tests for this...*/
  1358.  int run=0; /* if you Run from an encounter, then you will be labeled
  1359.              a coward and will loose half your gold! */
  1360.  int grab; /* random roll if you run, you'll loose this # of gold */
  1361. clear_it();
  1362.  
  1363. do
  1364. com = '0'; /* just a dummy value.. */
  1365.  
  1366. encounter(mf_src,mf_dest,pxyarray,scr6,&run);
  1367. if( run == 1) /* if you ran from an encounter while in the Gauntlet, then
  1368.              you'll be screwed!! */
  1369.  {
  1370.   clear_it();
  1371.   v_gtext(handle,6,11,"The crowd laughs at ");
  1372.   v_gtext(handle,6,19,"your cowardance! Two");
  1373.   v_gtext(handle,6,27,"burly guards grab you");
  1374.   v_gtext(handle,6,35,"and dump you outside.");
  1375.   v_gtext(handle,6,43,"As they turn to leave, ");
  1376.   v_gtext(handle,6,51,"one of the guards grabs");
  1377.   v_gtext(handle,6,59,"some of your gold.");
  1378.   grab = rnd(user.gold);
  1379.   user.gold -=grab;
  1380.   pause();
  1381.   return(1); /* tell calling module you ran */
  1382.  }
  1383.  
  1384. if( !run )
  1385. {
  1386. counter++;
  1387.  pause();
  1388.  if(counter < 50 && counter%10 == 0) /* if just didnt kill last monster
  1389.                                         and you've fought 10 monsters..*/
  1390.  {
  1391.    v_gtext(handle,6,11,"The crowd cheers your");
  1392.    v_gtext(handle,6,19,"victory!!");
  1393.    invoke_tsr( applause );
  1394.    v_gtext(handle,6,35,"(C)ontinue or (Q)uit");
  1395.    while (!(Bconstat(2)))
  1396.   {
  1397.     v_gtext(handle,14,35," "); v_gtext(handle,126,35," ");
  1398.    
  1399.      pauser();
  1400.     v_gtext(handle,14,35,"C"); v_gtext(handle,126,35,"Q");
  1401.    
  1402.      pauser();
  1403.  
  1404.    }
  1405.  
  1406.     do
  1407.     {
  1408.      com = Bconin(2);
  1409.     }while(com != 'C' && com != 'c' && com != 'Q' && com !='q');
  1410.  } /* end of counter < 50 */
  1411.  
  1412.     clear_it();  
  1413.    
  1414.     if( com == 'Q' || com == 'q' ) exit = 1;  /* exit. */
  1415.     if( exit == 1 && count < 50 ) /* if you exit and didnt finish
  1416.                                      the gauntlet... */
  1417.      {
  1418.       v_gtext(handle,6,11,"The crowd jeers you!!");
  1419.       pause();
  1420.      }
  1421.  
  1422.    if( counter == 50 )  /* you ran it !! */
  1423.     exit = 1;    
  1424.  
  1425. } /* end of ! run */
  1426. }while( !exit);
  1427.                        /* if you ran the guantlet and you 
  1428.                           havent done it before... */
  1429.   if( counter == 50 && user.user_items[14] != 1)
  1430.  {
  1431.   clear_it();
  1432.   v_gtext(handle,6,11,"The crowd goes wild!!");
  1433.   v_gtext(handle,6,19,"You ran the Gauntlet!");
  1434.   v_gtext(handle,6,35,"As you stagger out of ");
  1435.   v_gtext(handle,6,43,"the Arena towards the ");
  1436.   v_gtext(handle,6,51,"front gate,an apparat-");
  1437.   v_gtext(handle,6,59,"ion appears before you");
  1438.   v_gtext(handle,6,83,"<  press any key  >  ");
  1439.   com = Bconin(2);
  1440.    clear_it();
  1441.   v_gtext(handle,6,11,"It speaks...");
  1442.   v_gtext(handle,6,27,"You have proved your");
  1443.   v_gtext(handle,6,35,"valor to my master. ");
  1444.   v_gtext(handle,6,43,"He sends his greetings");
  1445.   v_gtext(handle,6,51,"..and this scroll. We ");
  1446.   v_gtext(handle,6,59,"shall meet again brave");
  1447.   v_gtext(handle,6,67,"One! ");
  1448.   v_gtext(handle,6,83,"<  press any key  >  ");
  1449.   com = Bconin(2);
  1450.    clear_it();        
  1451.   v_gtext(handle,6,11,"It disappears in a ");
  1452.   v_gtext(handle,6,19,"cloud of smoke. You");
  1453.   v_gtext(handle,6,27,"bend down to pick up");
  1454.   v_gtext(handle,6,35,"the scroll and wonder");
  1455.   v_gtext(handle,6,43,"what the hell that was");
  1456.   v_gtext(handle,6,51,"all about and slowly  ");
  1457.   v_gtext(handle,6,58,"unroll the scroll.....");
  1458.   v_gtext(handle,6,83,"<  press any key  >  ");
  1459.   com=Bconin(2);
  1460.    clear_it();        
  1461.   
  1462.   v_gtext(handle,6,19,"'You must come to me  ");
  1463.   v_gtext(handle,6,27,"at once. This key will");
  1464.   v_gtext(handle,6,35,"allow you to pass    ");
  1465.   v_gtext(handle,6,43,"through the gate that");
  1466.   v_gtext(handle,6,51,"guards my tower...   ");
  1467.   v_gtext(handle,6,58,"Be warned, my enemies");
  1468.   v_gtext(handle,6,83,"<  press any key  >  ");
  1469.   com=Bconin(2);
  1470.    clear_it();        
  1471.   v_gtext(handle,6,11,"will stop at nothing");
  1472.   v_gtext(handle,6,19,"to obtain this key! ");
  1473.   v_gtext(handle,6,27,"      -Lomir'  ");
  1474.   
  1475.   v_gtext(handle,6,51,"You grab the key    ");
  1476.   v_gtext(handle,6,59,"from the parchment  ");
  1477.   v_gtext(handle,6,67,"and make haste to-  ");
  1478.   v_gtext(handle,6,75,"wards the Arena gate");
  1479.   v_gtext(handle,6,83,"<  press any key >  ");
  1480.   com=Bconin(2);
  1481.  
  1482.   user.user_items[14] = 1;  /* give you the key */
  1483.   }
  1484.  
  1485. }
  1486.  
  1487. /** Bet()
  1488.  
  1489.     Bet on a fighter.
  1490.  
  1491. **/
  1492.  
  1493. bet()
  1494. {
  1495.  char com;
  1496.  int con_bonus,roll3;
  1497.  
  1498.   clear_it();
  1499.   v_gtext(handle,6,11,"Ah! the sporting type!");
  1500.   v_gtext(handle,6,19,"Just remember, anything");
  1501.   v_gtext(handle,6,27,"can happen in the arena");
  1502.   v_gtext(handle,6,43,"Who do you want to bet");
  1503.   v_gtext(handle,6,51,"on?");
  1504.   v_gtext(handle,6,59,"A) The Fighter  ");
  1505.   v_gtext(handle,6,67,"B) The Monster  ");
  1506.   v_gtext(handle,6,75,"E) Exit         ");
  1507.   v_gtext(handle,6,83,"Choice:");
  1508.   while (!(Bconstat(2)))
  1509.   {
  1510.     v_gtext(handle,6,59," "); 
  1511.     v_gtext(handle,6,67," ");
  1512.     v_gtext(handle,6,75," "); 
  1513.  
  1514.      pauser();
  1515.     v_gtext(handle,6,59,"A");
  1516.     v_gtext(handle,6,67,"B"); 
  1517.     v_gtext(handle,6,75,"E"); 
  1518.      pauser();
  1519.  
  1520.    }
  1521.  
  1522.  do
  1523.  {
  1524.   com = Bconin(2);
  1525.  }while( com !='A' && com !='a' && com !='B' && com!='b' && com !='E'
  1526.         && com !='e');
  1527. clear_it();
  1528.  if( user.gold < 20) v_gtext(handle,6,11,"Min. bet is 20gp!");
  1529.  if((com == 'B' || com == 'b' || com == 'A' || com == 'a') && user.gold >= 20)
  1530.   {
  1531.     roll3 = abs(rnd(100));  /* 100%. you have a 20% base chance! */
  1532.     con_bonus = user.con - 18; if(con_bonus < 0) con_bonus =0;
  1533.     roll3 +=con_bonus;
  1534.     if( roll3 > 80 )
  1535.      {
  1536.       v_gtext(handle,6,11,"You won 20 gp!");
  1537.       user.gold +=20;
  1538.      }
  1539.     else
  1540.      {
  1541.       v_gtext(handle,6,11,"Sorry, you lost..");
  1542.       user.gold -=20;
  1543.      }
  1544.     }/* end of not exit and gold > 20 */
  1545.  
  1546. pause();
  1547. }
  1548.  
  1549. /** 
  1550.     training()
  1551.  
  1552. **/
  1553. training()
  1554. {
  1555. char com;
  1556. int g,check_random;
  1557.  
  1558. clear_it();
  1559. do
  1560. {
  1561.   v_gtext(handle,6,11,"So yo wanna hone your");
  1562.   v_gtext(handle,6,19,"skills? Well we have ");
  1563.   v_gtext(handle,6,27,"the best instructors");
  1564.   v_gtext(handle,6,35,"around. (only 3000gp)");
  1565.   v_gtext(handle,6,51,"Practice what skill:");
  1566.   v_gtext(handle,6,59,"A) Strength");
  1567.   v_gtext(handle,6,67,"B) Dexterity");
  1568.   v_gtext(handle,6,75,"C) Intelligence");
  1569.   v_gtext(handle,6,83,"E) Exit");
  1570. while (!(Bconstat(2)))
  1571.   {
  1572.     v_gtext(handle,6,59," "); 
  1573.     v_gtext(handle,6,67," "); 
  1574.     v_gtext(handle,6,75," "); 
  1575.     v_gtext(handle,6,83," "); 
  1576.  
  1577.      pauser();
  1578.     v_gtext(handle,6,59,"A");
  1579.     v_gtext(handle,6,67,"B"); 
  1580.     v_gtext(handle,6,75,"C"); 
  1581.     v_gtext(handle,6,83,"E"); 
  1582.  
  1583.      pauser();
  1584.  
  1585.    }
  1586.  
  1587.  
  1588.  com = Bconin(2);
  1589. }
  1590.  while ( com != 'A' && com !='a' && com != 'B' && com != 'b' &&
  1591.          com != 'C' && com !='c' && com != 'E' && com != 'e'  );
  1592. clear_it();
  1593. if(user.gold < 3000){ v_gtext(handle,6,11,"You have not the");
  1594.                       v_gtext(handle,6,19,"funds...."); pause();}
  1595. else if( com != 'E' && com != 'e' )
  1596.  {
  1597.     v_gtext(handle,6,11,"Training..");
  1598.     user.gold -= 3000;
  1599.     for(g=0;g<3;g++)
  1600.       { 
  1601.         time = HOUR_VALUE; /* set so that an hour has passed */ 
  1602.       sleeppause();                /* train and update time at same time */
  1603.       check_random=events(); /* update events while working */
  1604.       
  1605.      }
  1606.  
  1607.    if(com == 'A' || com == 'a') user.str++;
  1608.    if(com == 'B' || com == 'b') user.dex++;
  1609.    if(com == 'C' || com == 'c') user.inte++;
  1610.    
  1611.  }
  1612.                      
  1613.  
  1614. }
  1615.  
  1616.  
  1617. /***/
  1618. dungeon()
  1619. {
  1620. char com;
  1621.  
  1622.  
  1623. v_gtext(handle,197,99,"   Dungeon    ");
  1624. clear_it();
  1625.   if( user.user_items[18] == 1 )                   /* lets you pass*/
  1626.     {                                              /*    into the dungeon */
  1627.       
  1628.        v_gtext(handle,6,11,"Enter the Dungeon?");
  1629.        v_gtext(handle,6,19,"[Y/N]             ");
  1630.        com = Bconin(2);
  1631.        if(com == 'Y' || com == 'y')
  1632.           {
  1633.            v_gtext(handle,6,35,"Insert the DUNGEON");
  1634.            v_gtext(handle,6,43,"into the drive and");
  1635.            v_gtext(handle,6,51,"press RETURN");
  1636.            com = Bconin(2);
  1637.           }
  1638.     }  
  1639.   else
  1640.     {
  1641.      v_gtext(handle,6,11,"An unseen force blocks");
  1642.      v_gtext(handle,6,19,"you from entering...");
  1643.     }
  1644. }
  1645.  
  1646.  
  1647.  
  1648. /** 
  1649.     Bank()
  1650.  
  1651. **/
  1652. bank()
  1653. {
  1654.  char com;
  1655.  
  1656. v_gtext(handle,197,99,"    Bank     ");
  1657.  
  1658. invoke_tsr( open2 );
  1659. if( count > 18 || count < 10 ) v_gtext(handle,6,19,"The Bank is closed.");
  1660. else
  1661. {
  1662. Kbrate(17,3);  
  1663.  
  1664. do
  1665. {
  1666.   clear_it();
  1667.   v_gtext(handle,6,11,"A stuffy looking clerk");
  1668.   v_gtext(handle,6,19,"approaches you and says");
  1669.   v_gtext(handle,6,27,"' How may I help you '");
  1670.   v_gtext(handle,6,43,"  (S)ell Gems/Jewels");
  1671.   v_gtext(handle,6,51,"  (D)eposit Gold    ");
  1672.   v_gtext(handle,6,59,"  (W)ithdraw Gold   ");
  1673.   v_gtext(handle,6,67,"  (E)xit            ");
  1674.   
  1675.   v_gtext(handle,6,83,"Choice:");
  1676.   while (!(Bconstat(2)))
  1677.   {
  1678.     v_gtext(handle,30,43," "); v_gtext(handle,30,51," ");
  1679.     v_gtext(handle,30,59," "); v_gtext(handle,30,67," ");
  1680.      pauser();
  1681.    v_gtext(handle,30,43,"S"); v_gtext(handle,30,51,"D");
  1682.     v_gtext(handle,30,59,"W"); v_gtext(handle,30,67,"E");    
  1683.   pauser();
  1684.  
  1685.    }
  1686.  
  1687.  do
  1688.  {
  1689.   com = Bconin(2);
  1690.  }while( com !='S' && com !='s' && com !='D' && com!='d' && com !='W'
  1691.         && com !='w' && com != 'e' && com !='E');
  1692.  
  1693. clear_it(); 
  1694.   if( com == 'S' || com == 's' ) sell_gem_jewel();
  1695.   if( com == 'W' || com == 'w' ) withdraw();
  1696.   if( com == 'D' || com == 'd' ) deposit();
  1697.   
  1698. display_user_stats();
  1699.  
  1700.  }while( com != 'E' && com !='e' );
  1701. Kbrate(255,255);  /* reset to no repeat.. */
  1702.  
  1703. } /* end of else */
  1704. } /* end of bank */
  1705. /**************************/
  1706. withdraw()
  1707. {
  1708.  long int withdraw_amount=0,bal;
  1709.  char com;
  1710.  int test=0;   /* if previous was 10 or > and then you went to 9.. clear */
  1711.  
  1712.  clear_it();
  1713.  
  1714.  bal = user.bank_balance; /* save balance as a cieling! */
  1715.  v_gtext(handle,6,11,"Your Balance is:");
  1716.  
  1717.  sprintf(string,"<%ld>",user.bank_balance);
  1718.  v_gtext(handle,6,19,string);
  1719.  sprintf(string,"Withdraw:%d",withdraw_amount);
  1720.  v_gtext(handle,6,27,string);
  1721.  
  1722.  v_gtext(handle,6,51,"Up arrow to increase");
  1723.  v_gtext(handle,6,59,"Down arrow to decrease");
  1724.  v_gtext(handle,6,67,"<Return> to confirm");
  1725.  v_gtext(handle,6,75," withdraw"); 
  1726. do
  1727.  {
  1728.  com = (char)(Bconin(2)>>16);
  1729.  if(com == 0x48) withdraw_amount +=1;
  1730.  if(com == 0x50) withdraw_amount -=1;
  1731.  if(withdraw_amount < 0) withdraw_amount =0;
  1732.  if(withdraw_amount > bal ) withdraw_amount = bal; /* upper bound */
  1733.  if(com == 0x48) user.bank_balance -=1;
  1734.  if(com == 0x50) user.bank_balance +=1; 
  1735.  if(user.bank_balance < 0) user.bank_balance = 0;
  1736.  if(user.bank_balance > bal) user.bank_balance = bal;
  1737.  sprintf(string,"<%ld>",user.bank_balance);
  1738.  v_gtext(handle,6,19,string);
  1739.  if( test > 9 && withdraw_amount == 9 || 
  1740.      test > 99 && withdraw_amount == 99)   /* if previous was > 9 and now its 9, clear */
  1741.  v_gtext(handle,6,27,"               ");  /* clear */
  1742.  sprintf(string,"Withdraw:%ld",withdraw_amount);
  1743.  v_gtext(handle,6,27,string);
  1744.  test = withdraw_amount;
  1745.  
  1746.  }while( com != 0x1c); /* until return is pressed */
  1747. user.gold +=withdraw_amount;  /* update user gold */
  1748. v_gtext(handle,6,75,"Thank You!");
  1749. pause();
  1750.  
  1751.  
  1752.  }
  1753.  
  1754.  
  1755. deposit()
  1756. {
  1757.  long int deposit_amount=0,temper;
  1758.  char com;
  1759.  int test=0;   /* if previous was 10 or > and then you went to 9.. clear */
  1760.  
  1761.  clear_it();
  1762.  v_gtext(handle,6,11,"Your coins in copper:");
  1763.  sprintf(string,"<%ld>",user.gold);
  1764.  v_gtext(handle,6,19,string);
  1765.  sprintf(string,"Deposit:%ld",deposit_amount);
  1766.  v_gtext(handle,6,35,string);
  1767.  v_gtext(handle,6,51,"Up arrow to increase");
  1768.  v_gtext(handle,6,59,"Down arrow to decrease");
  1769.  v_gtext(handle,6,67,"<Return> to confirm");
  1770.  v_gtext(handle,6,75," deposit");
  1771. temper = user.gold; 
  1772. do
  1773.  {
  1774.  com = (char)(Bconin(2)>>16);
  1775.  if(com == 0x48) deposit_amount +=1;
  1776.  if(com == 0x50) deposit_amount -=1;
  1777.  if(deposit_amount < 0) deposit_amount =0;
  1778.  if(deposit_amount > user.gold) deposit_amount = user.gold;
  1779. temper = user.gold - deposit_amount;
  1780. sprintf(string,"<%ld>",temper);
  1781.  v_gtext(handle,6,19,string); 
  1782. if( test > 9 && deposit_amount == 9 || 
  1783.      test > 99 && deposit_amount == 99)   /* if previous was > 9 and now its 9, clear */
  1784.  v_gtext(handle,6,35,"               ");  /* clear */
  1785.  sprintf(string,"Deposit:%ld",deposit_amount);
  1786.  v_gtext(handle,6,35,string);
  1787. test = deposit_amount;
  1788.  }while( com != 0x1c); /* until return is pressed */
  1789. user.gold -=deposit_amount;  /* update user gold */
  1790. user.bank_balance += deposit_amount; /* credit it to bank balance */
  1791. v_gtext(handle,6,75,"Thank You!");
  1792. pause();
  1793. }   
  1794.  
  1795.  
  1796. /***/
  1797. sell_gem_jewel()
  1798. {
  1799.  char com;
  1800.  int exit = 0;
  1801.  
  1802.  if ( user.user_items[4]==0 && user.user_items[5]==0 )
  1803.   {
  1804.   v_gtext(handle,6,11,"You dont seem to have");
  1805.   v_gtext(handle,6,19,"any gems/jewels to   ");
  1806.   v_gtext(handle,6,27,"sell....");
  1807.   v_gtext(handle,6,51,"  < press any key > ");
  1808.   com = Bconin(2);
  1809.   }
  1810.  else
  1811.   {
  1812.   v_gtext(handle,6,11,"Sell what:");
  1813.   sprintf(string,"(G)ems    :%d",user.user_items[4]);
  1814.   v_gtext(handle,6,19,string);
  1815.   sprintf(string,"(J)ewels  :%d",user.user_items[5]);
  1816.   v_gtext(handle,6,27,string);
  1817.   v_gtext(handle,6,35,"(E)xit ");
  1818.   v_gtext(handle,6,51,"Choice: ");
  1819.   do
  1820.   {
  1821.   com = Bconin(2);
  1822.   }while( com != 'G' && com !='g' && com !='J' && com !='j' && com !='E' && com !='e');
  1823. clear_it();   
  1824.   if( (com == 'G' || com == 'g') && user.user_items[4] == 0)
  1825.    { v_gtext(handle,6,11,"You dont have any Gems!");
  1826.      exit = 1;
  1827.    }
  1828.   if( (com == 'J' || com == 'j') && user.user_items[5] == 0)
  1829.    { v_gtext(handle,6,11,"You dont have any!");
  1830.      exit = 1;
  1831.    }
  1832.  
  1833.   if(exit == 0)  /* if you have some to sell.. */
  1834.    {
  1835.     if(com == 'J' || com == 'j')
  1836.     compute_sell(5);  /* 5 is index to jewels */
  1837.     if( com == 'G' || com == 'g')
  1838.     compute_sell(4);
  1839.    }
  1840.   
  1841. pause();
  1842.   } /* end of else. sell....*/
  1843. }/* end of sell gem/jewels */
  1844.  
  1845.  
  1846.  
  1847. /**************************/
  1848. /* index: 4 or 5.. 5 is index to jewels, 4 index to gems */
  1849. compute_sell(index)
  1850. int index;
  1851. {
  1852.  int good;
  1853.  
  1854.     good = abs(rnd(100)); /* you have a 75% chance its good... */
  1855.            if(good < 25)
  1856.           v_gtext(handle,6,11,"It's no good!!");
  1857.         else
  1858.          {
  1859.           good = abs(rnd(77));
  1860.           sprintf(string,"It's worth %d gp",good);
  1861.           v_gtext(handle,6,83,string);
  1862.                 user.gold +=good;
  1863.          }
  1864.             user.user_items[index]--;
  1865. } /* end of if sell */ 
  1866.  
  1867.  
  1868. /**************************/
  1869.  
  1870. /**
  1871.     check_time()
  1872.    am_pm, count and way are globals...
  1873.  
  1874.  
  1875. **/
  1876. check_time()
  1877. {
  1878.  char com2;
  1879.  
  1880.  if(count > 12)
  1881.  {
  1882.   if(count == 24) sprintf(string,"The time is:12 am");
  1883.   else sprintf(string,"The time is:%d pm",count - 12);
  1884.  } 
  1885.  
  1886. if(count < 13)
  1887. {
  1888.   if(count == 12) sprintf(string,"The time is:12 pm");
  1889.   else sprintf(string,"The time is:%d am",count);
  1890. }
  1891.      v_gtext(handle,6,11,string);   /* display time */
  1892.    
  1893.    v_gtext(handle,6,67,"Press any key");
  1894.    com2 = Bconin(2);
  1895.  }
  1896. /*********/
  1897. pauser()
  1898. {
  1899.  char tsecs;
  1900.    for(tsecs=0;tsecs<60;tsecs++)
  1901.         Vsync();
  1902.   
  1903. }
  1904. /**********/
  1905. sleeppause()
  1906. {
  1907.   char tsecs;
  1908.   int realtime=0;
  1909.  
  1910.      
  1911.      for(tsecs=0;tsecs<60;tsecs++)
  1912.         {Vsync();
  1913.            if( realtime%5 == 0 )    /* stagger */
  1914.         {
  1915.         switch(realtime%4)
  1916.           {
  1917.            case 0: v_gtext(handle,276,110,"<");  
  1918.                    break;
  1919.            case 1: v_gtext(handle,276,110,"=");  break;
  1920.            case 2: v_gtext(handle,276,110,">");  break;
  1921.            case 3: v_gtext(handle,276,110,"?"); 
  1922.           }
  1923.         }       
  1924.        realtime++;
  1925.        if ( realtime > 32767 ) realtime = 0;
  1926.  
  1927.         }
  1928. }
  1929.